package util.validators 
{
	/**
	 * ...
	 * @author Kasoi
	 */
	public class EmailValidator
	{
		
        public static const EMAIL_REGEX: RegExp = /^[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$/i;
		
        public static function isValidEmail(email: String) : Boolean
		{
            return Boolean(email.match(EMAIL_REGEX));
        }
        
        public static function isValidEmails(emailList: String, separator: String = ",") : Boolean
		{
            var addresses: Array = emailList.split(separator);
            for each (var email: String in addresses)
			{
                if (!isValidEmail(email.replace(/\s/, ""))) return false;
            }
            return true;
        }
		
	}

}